package com.cn.yang.controller;

import com.alibaba.fastjson.JSONObject;
import com.cn.yang.bean.DianDao;
import com.cn.yang.bean.Group;
import com.cn.yang.bean.Weiji;
import com.cn.yang.service.WeijiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/weiji")
public class WeijiController {
    @Autowired
    WeijiService weijiService;
    @RequestMapping("/weijiAdd")
    public JSONObject weijiAdd(@RequestBody Weiji weiji){
        int result = weijiService.weijiAdd(weiji);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("result",result);
        return jsonObject;
    }
    @RequestMapping("/selectAllData")
    public JSONObject selectAllData(@RequestBody Weiji weiji) {
        List<DianDao> list = weijiService.selectAllData(weiji);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("list",list);
        return jsonObject;
    }
}
